home *** CD-ROM | disk | FTP | other *** search
- /*
- cvintrvw.cpp
-
- Intro window (C++/Views window)
-
- C++/Views 2.0 Demo
- Copyright (c) 1992, by Liant Software Corp.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- */
-
- #include "cvintrvw.h"
- #include "cvdemovw.h"
- #include "editbox.h"
- #include "messengr.h"
- #include "port.h"
-
- defineClass(IntroView, VMdiView)
-
- IntroView::IntroView()
- {
- ;
- }
-
- IntroView::IntroView(VFrame &f, DemoAppView *parent)
- : VMdiView("IntroIcon", f, (VWindow *) parent, StyleBorder | StyleTitle | StyleCloseBox | StyleSizable)
- {
- mainWin = parent;
-
- setTitle("Welcome");
-
- /* create an editbox to display startup text */
- VEditBox *eb;
-
- eb = new VEditBox(VFrame(0.05F, 0.5F, 0.9F, 0.35F), this,
- StyleBorder | StyleVertical | StyleWordWrap | StyleReadOnly);
-
- eb->putText(cvTextFile->getMessage("Startup:Text").gets());
- eb->takeFocus();
-
- /* make sure the "About this Window" data is set up */
- mainWin->setAboutNames("Intro:About", "cvintrvw.cpp");
- }
-
- IntroView::~IntroView()
- {
- ;
- }
-
- boolean IntroView::free()
- {
- delete this;
- return(TRUE);
- }
-
- boolean IntroView::close()
- /*
- The user has closed the window.
- Notify the main window so that it can update the main menu bar
- */
- {
- mainWin->introView = 0;
- mainWin->updateMenu();
- return(FALSE);
- }
-
- boolean IntroView::paint()
- /*
- Draw the C++/Views banner
- */
- {
- VPort p(this);
- VPen pn;
- VBrush br(BLUE);
- VRectangle rect;
-
- int x, y, w, h;
- int points = 80;
- int off = 3;
- getArea(&x, &y, &w, &h);
-
- /* adjust size of font based on size of window */
- if (w < 550) {
- points = 50;
- off = 2;
- }
- if (w < 350) {
- points = 25;
- off = 2;
- }
- if (w < 125) {
- points = 12;
- off = 1;
- }
- if (w < 75) {
- points = 8;
- off = 1;
- }
-
- VFont fbig("New Times Roman", points);
-
- rect.set(CornerDim, x, y, w, h);
-
- p.open();
- p.useFont(&fbig);
- p.usePen(&pn);
- p.useBrush(&br);
-
- pn.color(BLUE);
-
- p.fillRegion(&rect);
-
- rect.set(CornerDim, x, y + h/6, w, h / 2);
-
- rect.move(off, off);
- pn.color(GRAY);
- p.wrtText("C++/ Views", &rect, JustifyCenter);
-
- rect.move(-off, -off);
- pn.color(WHITE);
- p.wrtText("C++/ Views", &rect, JustifyCenter);
-
- p.close();
-
- return(TRUE);
- }
-
- boolean IntroView::erased()
- /*
- Intercept automatic background erasure.
- */
- {
- return(TRUE);
- }
-
- boolean IntroView::givenFocus()
- /*
- Our window has just been given input focus
- */
- {
- /* set the data for the About this Window dialog */
- mainWin->setAboutNames("Intro:About", "cvintrvw.cpp");
-
- /* carry on with default window behavior, return FALSE */
- return(FALSE);
- }
-
-